
<%@ page import="edu.auctionmart.Auction" %>
<!doctype html>
<html>
    <head>
        <meta name="layout" content="mobile">
        <g:set var="entityName" value="${message(code: 'auction.label', default: 'Auction')}" />
        <title><g:message code="default.show.label" args="[entityName]" /></title>
    </head>
    <body>
		<div data-role="header" data-position="fixed">
			<h1><g:message code="default.show.label" args="[entityName]" /></h1>
			<div data-role="navbar">
				<ul>
					<li><a data-icon="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
					<li><g:link data-icon="grid" data-ajax="false" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></li>
				</ul>
			</div>
		</div>
		<div data-role="content">
			<g:if test="${flash.message}">
			<div class="message">${flash.message}</div>
			</g:if>
				
			<h2><g:fieldValue bean="${auctionInstance}" field="auctionTitle"/></h2>
			<dl>
											
				<dt><g:message code="auction.seller.label" default="Seller" /></dt>
				<dd><dd><g:fieldValue bean="${auctionInstance}" field="seller"/></dd>
				
				<dt><g:message code="auction.item.label" default="Item" /></dt>
				<dd><g:link controller="item" action="show" id="${auctionInstance?.item?.id}">${auctionInstance?.item?.encodeAsHTML()}</g:link></dd>
					
				<dt><g:message code="auction.bids.label" default="Number of Bids" /></dt>
				<dd>${auctionInstance?.bids.size()}</dd>
						
				<dt><g:message code="auction.startTime.label" default="Start Time" /></dt>		
				<dd><g:fieldValue bean="${auctionInstance}" field="startTime"/></dd>
				
				<dt><g:message code="auction.endTime.label" default="End Time" /></dt>	
				<dd><g:fieldValue bean="${auctionInstance}" field="endTime"/></dd>	
			
				<dt><g:message code="auction.startBid.label" default="Start Bid" /></dt>	
				<dd><g:fieldValue bean="${auctionInstance}" field="startBid"/></dd>

				<dt><g:message code="auction.hiddenMinBid.label" default="Hidden Min Bid" /></dt>	
				<dd><g:fieldValue bean="${auctionInstance}" field="hiddenMinBid"/></dd>
				
				<dt><g:message code="auction.currentBid.label" default="Current Bid" /></dt>	
				<dd><g:link controller="bid" action="show" id="${auctionInstance?.currentBid?.id}">${auctionInstance?.currentBid?.encodeAsHTML()}</g:link></dd>
	
				<dt><g:message code="auction.status.label" default="Status" /></dt>
				<dd><g:fieldValue bean="${auctionInstance}" field="status"/></dd>
			</dl>
			
			<g:form>
				<fieldset class="buttons">
					<g:hiddenField name="id" value="${auctionInstance?.id}" />
					<g:if test="${auctionInstance?.currentBid}">
						<g:field type="number" id="maxBid" name="maxBid"
							min="${auctionInstance.currentBid.getAmount()}"
							value="${fieldValue(bean: auctionInstance.currentBid, field: 'amount')}" />

					</g:if>
					<g:else>
						<g:field type="number" id="maxBid" name="maxBid"
							min="${auctionInstance.startBid}"
							value="${fieldValue(bean: auctionInstance, field: 'startBid')}" />

					</g:else>
					<g:actionSubmit action="bid" value="Place bid" onclick="return confirm('Confirm bid');" />
				</fieldset>
			</g:form>

		</div>
		<div data-role="footer">
		</div>
    </body>
</html>
